Skip to content

Conversation

@NicolaCourtier
Copy link
Member

Description

Add a continuous integration test that employs the lowest-direct dependencies, alongside the existing nightly check on the latest dependencies, to inform the lowest supported versions that we state in the pyproject.toml.

Type of change

Please add a line in the relevant section of CHANGELOG.md to document the change (include PR #).

Important checks:

Please confirm the following before marking the PR as ready for review:

  • No style issues: $ pre-commit run or $ nox -s pre-commit (see CONTRIBUTING.md for how to set this up to run automatically when committing locally, in just two lines of code)
  • All tests pass: nox -s tests
  • The documentation builds: nox -s doctest
  • Code is commented for hard-to-understand areas
  • Tests added that prove fix is effective or that feature works

@NicolaCourtier NicolaCourtier marked this pull request as draft December 15, 2025 14:24
@codecov
Copy link

codecov bot commented Dec 15, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.79%. Comparing base (4628a65) to head (2932d63).
⚠️ Report is 15 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #858      +/-   ##
===========================================
+ Coverage    89.41%   90.79%   +1.37%     
===========================================
  Files           63       66       +3     
  Lines         4857     5160     +303     
===========================================
+ Hits          4343     4685     +342     
+ Misses         514      475      -39     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@NicolaCourtier
Copy link
Member Author

Hi @agriyakhetarpal, I'm hoping you may have some advice!
The aim of this PR is to periodically check the lowest dependency versions that we say we support in the pyproject.toml. It wouldn't need to be run very often, but it would be nice to keep the lowest versions up-to-date. The command uv pip install --resolution lowest-direct -e .[all,dev] seems to do what I want locally, but simply adding this option to the GitHub action does not work. Would you recommend such a test and if so, how can it be implemented?

Copy link
Member

@agriyakhetarpal agriyakhetarpal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @NicolaCourtier, I actually asked about this in the Scientific Python Discord server previously, but I forgot to respond to you here. Apologies! The command you have mentioned is the closest that will work for us here. I think the issue is that you are using pip instead of uv pip?

Besides this, one option is to adopt SPEC 0: https://scientific-python.org/specs/spec-0000/. It features a companion GitHub Action that we can use. However, PyBaMM has not adopted SPEC 0 yet, which is why I think it may not be the best idea for PyBOP. I think it would still be worth experimenting, however. See pybamm-team/PyBaMM#5202 for further discussion.

Another option I am aware of is to use a file like this: https://github.com/scikit-learn/scikit-learn/blob/ce1b377f3bb2580e7cc1e35ba7eed2131e3b8e8e/sklearn/_min_dependencies.py, though it will require us to add some extra CI setup.

@NicolaCourtier NicolaCourtier changed the base branch from develop to update-pybamm-constants January 17, 2026 11:23
@NicolaCourtier
Copy link
Member Author

Thanks very much for the suggestions @agriyakhetarpal

When trying the first, unfortunately it returns:
Error: Unable to resolve action actions/setup-uv, repository not found
See here

Copy link
Member

@agriyakhetarpal agriyakhetarpal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, sorry, the action repository is hosted under Astral's organisation and not GitHub's.

@NicolaCourtier NicolaCourtier deleted the branch develop January 17, 2026 23:11
@NicolaCourtier NicolaCourtier changed the base branch from update-pybamm-constants to develop January 17, 2026 23:16
@NicolaCourtier
Copy link
Member Author

Oops, didn't mean to close! Open again now, but there's a new error?

@agriyakhetarpal
Copy link
Member

Yes, this is because the setup-uv action installs a standalone uv, instead of adding a Python environment and installing uv from its Python distribution. Or so I think. Let's try!

@agriyakhetarpal
Copy link
Member

agriyakhetarpal commented Jan 17, 2026

Triggered a run, and it looks like it's working: https://github.com/pybop-team/PyBOP/actions/runs/21102561524, though it fails because it's somehow trying to install numpy==1.3.0 which is way too old. We've gone back to the Python 2 era :)

@NicolaCourtier
Copy link
Member Author

NicolaCourtier commented Jan 17, 2026

Great, then the test is working! It should fail for any minimum dependency that is too low. I only updated the numpy/scipy minimum in this PR! So we would expect the action to fail on develop. Thank you!

@NicolaCourtier NicolaCourtier marked this pull request as ready for review January 17, 2026 23:48
Copy link
Member

@agriyakhetarpal agriyakhetarpal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome! Thanks, @NicolaCourtier!

@NicolaCourtier NicolaCourtier merged commit cc5246b into develop Jan 17, 2026
33 of 41 checks passed
@agriyakhetarpal agriyakhetarpal deleted the ci-lowest-resolution branch January 17, 2026 23:54
@NicolaCourtier
Copy link
Member Author

Oh dear, same error after merging... looks like I can't just leave the numpy minimum unspecified (I assumed it would be be contemporary with the scipy version)

@agriyakhetarpal
Copy link
Member

Ah, yeah... I think a safe minimum for us would be NumPy 1.25.x series. I can't think of a reason we will use anything below that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants